package com.xinqi.modules.course.content.dto.client;

import com.xinqi.common.base.constants.ServiceNameConstants;
import com.xinqi.common.base.response.R;
import com.xinqi.modules.course.content.dto.req.CourseContentCreateDTO;
import com.xinqi.modules.course.content.dto.req.CourseContentUpdateDTO;
import com.xinqi.modules.course.content.dto.rsp.CourseContentResultDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(contextId = "courseContentClient", value = ServiceNameConstants.XQ_COURSE)
public interface CourseContentClient {

    /**
     * 添加或更新 课程汇总内容
     *
     * @return
     */
    @PostMapping("/inner/course/content/save")
    R<Boolean> saveContent(@RequestBody CourseContentCreateDTO creat);

    /**
     * 添加或更新 课程汇总内容
     *
     * @return
     */
    @PutMapping("/inner/course/content/update/{id}")
    R<Boolean> updateById(@PathVariable(value = "id") Long id, @RequestBody CourseContentUpdateDTO update);

    @PutMapping("/inner/course/content/updateBatch")
    R<Boolean> updateBatch(@RequestBody List<CourseContentUpdateDTO> updateList);


    @GetMapping("/inner/course/content/selectByContentIdAndType/{contentId}")
    R<CourseContentResultDTO> selectByContentIdAndType(@PathVariable(value = "contentId") Long contentId, @RequestParam(value = "type") Integer type);

    /**
     * 批量添加或更新 课程汇总内容
     *
     * @return
     */
    @PostMapping("/inner/course/content/saveBatch")
    R<Boolean> saveBatchContent(@RequestBody List<CourseContentCreateDTO> list);

    /**
     * 获取课程汇总内容信息
     *
     * @return
     */
    @GetMapping("/inner/course/content/findById")
    R<CourseContentResultDTO> findContentById(@RequestParam(value = "contentId") Long contentId);

    /**
     * 获取课程汇总内容信息列表
     *
     * @return
     */
    @GetMapping("/inner/course/content/list")
    R<List<CourseContentResultDTO>> findContentList(@RequestParam(value = "ids") List<Long> ids);

    @GetMapping("/inner/course/content/findContentListByContentIdsAndType")
    R<List<CourseContentResultDTO>> findContentListByIdsAndType(@RequestParam(value = "contentIds") List<Long> contentIds, @RequestParam(value = "type") Integer type);

    /**
     * 删除课程汇总内容信息
     *
     * @return
     */
    @DeleteMapping("/inner/course/content/removeById")
    R<Boolean> removeById(@RequestParam(value = "contentId") Long contentId);

    /**
     * 删除课程汇总内容信息
     *
     * @return
     */
    @DeleteMapping("/inner/course/content/deleteCourseContentByIds")
    R<Boolean> deleteCourseContentByIds(@RequestParam(value = "contentIds") List<Long> contentIds, @RequestParam(value = "type") Integer type);

    /**
     * 批量删除课程汇总内容信息
     *
     * @return
     */
    @DeleteMapping("/inner/course/content/removeByIds")
    R<Boolean> removeByIds(@RequestParam(value = "ids") List<Long> ids);


    @PostMapping("/inner/course/content/find")
    R<Boolean> update(@RequestParam("status") Integer status, @RequestParam("type") Integer type, @RequestParam("contentIdList") List<Long> contentIdList);

}
